<?php
/**
 * 执行反馈项目-动作-题目数据
 * @author qianxun
 *
 */
class proActItemModel extends MY_Model{
    function proActItemModel(){
        parent::MY_Model();
        $this->table = 'ProActItem';
    }
    /**
     * 包装数据(non-PHPdoc)
     * @see MY_Model::packing()
     */
    function packing($list = array()){
        foreach ($list as $k => $v){
            $v['otherData'] = unserialize($v['otherData']);
            $list[$k] = $v;
        }
        return $list;
    }
    /**
     * 获取指定项目的题目列表
     * @param number $projectId
     * @return array
     */
    function getActItem($projectId){
        $this->load->model('proActModel');
        $actList = $this->proActModel->getList(array('proId'=>$projectId,'isDel'=>0));
        $actIds = array();
        foreach ($actList as $v){
            in_array((int)$v['actId'], $actIds) || $actIds[] = (int)$v['actId'];
        }
        $findList = $this->proActItemModel->getNewList(array('proId'=>$projectId,'actId'=>array('in', $actIds),'isDel'=>0),'','','itemId,proId,actId,type,itemTitle,itemDesc,isRequired,otherData','orderNum ASC,itemId ASC');
        $list = array();
        foreach ($findList as $v){
            $list[$v['itemId']] = $v;
        }
        return $list;
    }
}